var jenis_perawatan_template = jQuery.format($('#template_jenis_perawatan_item').val());
var camelCase = function(str){
	var words = str.split(" "); 
	for (var i=0 ; i < words.length ; i++){ 
		var testwd = words[i]; 
		var firLet = testwd.substr(0,1); 
		var rest = testwd.substr(1, testwd.length -1);
		words[i] = firLet.toUpperCase() + rest; 
	}
	
	str = words.join(" ");
	return str;
}

$('select#jenis_perawatan').dblclick(function(){
	var val = $('select#jenis_perawatan option:selected').val();
	$('select#jenis_perawatan option:selected').remove();	
	$('div#item_container').append(jenis_perawatan_template(val));
});

$('span.close').live('click', function(){
	var val = $(this).parent().find('.item').text();
	var option = jQuery.format('<option value="{0}">{0}</option>');	
	$('select#jenis_perawatan').append(option(camelCase(val)));
	$(this).parent().remove();
});